#{extends 'magicBox.html' /}
#{set 'title'}Story: ${story.number} #{ifnot inSprint}
#{if connected.in(project).can('deleteStory')}<a href="javascript:deleteStory(${story.id}, this, ${hasDependency});"><img title="Delete" src="@{'/public/images/famfam/delete.png'}"></a>#{/if}#{if connected.in(project).can('editStory')}<a href="javascript:overlayOpen('/admin/storys/${story.id}')"><img title="Edit" src="@{'/public/images/famfam/pencil.png'}"></a><a href="javascript:overlayOpen('/storys/editScenario?id=${story.id}')"><img title="Edit Scenarios" src="@{'/public/images/editsce.gif'}"></a>#{/if}
<a onclick="javascript:overlayOpen('/admin/tasks/new?id2=${story.id}')"><img title="Add Task" src="@{'/public/images/add_task.gif'}"></a>#{/ifnot}#{/set}

#{if connected.in(project).can('editStory')}
#{ifnot message.length() == 0}
	#{note}${message}#{/note}
#{/ifnot}
	#{if story.productRole==null}
	${story.description}<br>
	#{/if}
	#{elseif story.productRole!=null && (story.productRole.name[0]=='a'||story.productRole.name[0]=='e'||story.productRole.name[0]=='i'||story.productRole.name[0]=='o')}
	As an ${story.productRole.name}, ${story.description}<br>
	#{/elseif}
	#{elseif story.productRole!=null}
	As a ${story.productRole.name}, ${story.description}<br>
	#{/elseif}
	<b>Success Scenarios</b><br>
	
	#{list items:success, as:'suc'}
		#{if suc!=null}
		%{ 
		int s=0;
		
		if (suc.trim().length() == 0)
		{
			s++;
		}
		
		else
		{
			out.print(suc+"<br>");
		}	
		
		if(s == success.length)
		{
			out.print("No success scenarios are defined for this story.<br>");
		}
	}%
	#{/if}
	#{/list}
	
	<br><b>Failure Scenarios</b><br>
	#{if fail!=null}
	#{list items:failure, as:'fail'}
	
	%{ int i=0;
	
		if (fail.trim().length() == 0)
		{
			i++;
		}
		else
		{
			out.print(fail+"<br>");
		}	
		
		if(i == failure.length)
		{
			out.print("No failure scenarios are defined for this story.<br>");
		}
	}%
	#{/list}
	#{/if}<br>
	#{list items:story.storiesTask, as:'task'}
		<div name="/storys/magicShow?taskId=${task.id}">S${story.number} ${task.description}<div class="item_imgs">#{if connected.in(project).can('deleteTask')}<a onclick="javascript:deleteTheTask(${task.id},this);"><img title="Delete" src="@{'/public/images/famfam/delete.png'}"></a>#{/if}#{if connected.in(project).can('modifyTask') &&  !task.checkUnderImpl()}<a onclick="javascript:overlayOpen('/admin/tasks/${task.id}')"><img title="Edit" src="@{'/public/images/famfam/pencil.png'}"></a>#{/if}</div><div  class="right" title="Type: ${task.taskType.name}" style="background:${task.taskType.hexColor}; width: 15px; height: 15px; border-color:white; position:relative;" ></div></div>
	#{/list}
#{/if}
